﻿<UserControl x:Class="TheCodeHaven.SauceClassGeneration.MyControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             Background="{DynamicResource VsBrush.Window}"
             Foreground="{DynamicResource VsBrush.WindowText}"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300"
             Name="MyToolWindow">
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="25" />
            <RowDefinition Height="25" />
            <RowDefinition Height="115" />
            <RowDefinition Height="25" />
            <RowDefinition Height="*" />
            <RowDefinition Height="25" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="180" />
            <ColumnDefinition />
        </Grid.ColumnDefinitions>

        <Label Grid.Row="0">Target Project</Label>
        <ComboBox Grid.Row="0" Grid.Column="1" Name="TargetProject" SelectionChanged="TargetProject_SelectionChanged" DisplayMemberPath="Name" />


        <Label Grid.Row="1">Database Server Type</Label>
        <ComboBox Grid.Row="1" Grid.Column="1" Name="ServerType" DisplayMemberPath="Name" SelectionChanged="ServerType_SelectionChanged" />

        <GroupBox Name="SettingsContainer" Grid.Row="2" Grid.ColumnSpan="2" Header="Connection Details">
        </GroupBox>

        <Button Grid.Column="0" Grid.Row="3" Click="FetchObjects">Fetch Objects</Button>

        <GroupBox Name="TableContainer" Grid.Row="4" Grid.ColumnSpan="2" Header="Choose Tables">
            <DataGrid Name="Tables" AutoGenerateColumns="False" CanUserAddRows="False" CanUserDeleteRows="False">
                <DataGrid.Columns>
                    <DataGridTextColumn Header="Schema" IsReadOnly="True" Binding="{Binding Object.Schema}" />
                    <DataGridTextColumn Header="Name" IsReadOnly="True" Binding="{Binding Object.Name}" />
                    <DataGridTextColumn Header="Column Count" IsReadOnly="True" Binding="{Binding Object.Columns.Count}" />
                    <DataGridTextColumn Header="Object Type" IsReadOnly="True" Binding="{Binding Type}" />
                </DataGrid.Columns>
            </DataGrid>
        </GroupBox>

        <Button Name="GenerateButton" Grid.Column="0" Grid.Row="5" Click="GenerateClassFiles" IsEnabled="False">Generate!</Button>
    </Grid>
</UserControl>
